| 1 | /* $NetBSD: postfix.c,v 1.2 2017/02/14 01:16:46 christos Exp $ */ |
| 2 | |
| 3 | /*++ |
| 4 | /* NAME |
| 5 | /* postfix 1 |
| 6 | /* SUMMARY |
| 7 | /* Postfix control program |
| 8 | /* SYNOPSIS |
| 9 | /* .fi |
| 10 | /* \fBpostfix\fR [\fB-Dv\fR] [\fB-c \fIconfig_dir\fR] \fIcommand\fR |
| 11 | /* DESCRIPTION |
| 12 | /* This command is reserved for the superuser. To submit mail, |
| 13 | /* use the Postfix \fBsendmail\fR(1) command. |
| 14 | /* |
| 15 | /* The \fBpostfix\fR(1) command controls the operation of the Postfix |
| 16 | /* mail system: start or stop the \fBmaster\fR(8) daemon, do a health |
| 17 | /* check, and other maintenance. |
| 18 | /* |
| 19 | /* By default, the \fBpostfix\fR(1) command sets up a standardized |
| 20 | /* environment and runs the \fBpostfix-script\fR shell script |
| 21 | /* to do the actual work. |
| 22 | /* |
| 23 | /* However, when support for multiple Postfix instances is |
| 24 | /* configured, \fBpostfix\fR(1) executes the command specified |
| 25 | /* with the \fBmulti_instance_wrapper\fR configuration parameter. |
| 26 | /* This command will execute the \fIcommand\fR for each |
| 27 | /* applicable Postfix instance. |
| 28 | /* |
| 29 | /* The following commands are implemented: |
| 30 | /* .IP \fBcheck\fR |
| 31 | /* Warn about bad directory/file ownership or permissions, |
| 32 | /* and create missing directories. |
| 33 | /* .IP \fBstart\fR |
| 34 | /* Start the Postfix mail system. This also runs the configuration |
| 35 | /* check described above. |
| 36 | /* .IP \fBstop\fR |
| 37 | /* Stop the Postfix mail system in an orderly fashion. If |
| 38 | /* possible, running processes are allowed to terminate at |
| 39 | /* their earliest convenience. |
| 40 | /* .sp |
| 41 | /* Note: in order to refresh the Postfix mail system after a |
| 42 | /* configuration change, do not use the \fBstart\fR and \fBstop\fR |
| 43 | /* commands in succession. Use the \fBreload\fR command instead. |
| 44 | /* .IP \fBabort\fR |
| 45 | /* Stop the Postfix mail system abruptly. Running processes are |
| 46 | /* signaled to stop immediately. |
| 47 | /* .IP \fBflush\fR |
| 48 | /* Force delivery: attempt to deliver every message in the deferred |
| 49 | /* mail queue. Normally, attempts to deliver delayed mail happen at |
| 50 | /* regular intervals, the interval doubling after each failed attempt. |
| 51 | /* .sp |
| 52 | /* Warning: flushing undeliverable mail frequently will result in |
| 53 | /* poor delivery performance of all other mail. |
| 54 | /* .IP \fBreload\fR |
| 55 | /* Re-read configuration files. Running processes terminate at their |
| 56 | /* earliest convenience. |
| 57 | /* .IP \fBstatus\fR |
| 58 | /* Indicate if the Postfix mail system is currently running. |
| 59 | /* .IP "\fBset-permissions\fR [\fIname\fR=\fIvalue ...\fR]" |
| 60 | /* Set the ownership and permissions of Postfix related files and |
| 61 | /* directories, as specified in the \fBpostfix-files\fR file. |
| 62 | /* .sp |
| 63 | /* Specify \fIname\fR=\fIvalue\fR to override and update specific |
| 64 | /* main.cf configuration parameters. Use this, for example, to |
| 65 | /* change the \fBmail_owner\fR or \fBsetgid_group\fR setting for an |
| 66 | /* already installed Postfix system. |
| 67 | /* .sp |
| 68 | /* This feature is available in Postfix 2.1 and later. With |
| 69 | /* Postfix 2.0 and earlier, use "\fB$config_directory/post-install |
| 70 | /* set-permissions\fR". |
| 71 | /* .IP "\fBtls\fR \fIsubcommand\fR" |
| 72 | /* Enable opportunistic TLS in the Postfix SMTP client or |
| 73 | /* server, and manage Postfix SMTP server TLS private keys and |
| 74 | /* certificates. See postfix-tls(1) for documentation. |
| 75 | /* .sp |
| 76 | /* This feature is available in Postfix 3.1 and later. |
| 77 | /* .IP "\fBupgrade-configuration\fR [\fIname\fR=\fIvalue ...\fR]" |
| 78 | /* Update the \fBmain.cf\fR and \fBmaster.cf\fR files with information |
| 79 | /* that Postfix needs in order to run: add or update services, and add |
| 80 | /* or update configuration parameter settings. |
| 81 | /* .sp |
| 82 | /* Specify \fIname\fR=\fIvalue\fR to override and update specific |
| 83 | /* main.cf configuration parameters. |
| 84 | /* .sp |
| 85 | /* This feature is available in Postfix 2.1 and later. With |
| 86 | /* Postfix 2.0 and earlier, use "\fB$config_directory/post-install |
| 87 | /* upgrade-configuration\fR". |
| 88 | /* .PP |
| 89 | /* The following options are implemented: |
| 90 | /* .IP "\fB-c \fIconfig_dir\fR" |
| 91 | /* Read the \fBmain.cf\fR and \fBmaster.cf\fR configuration files in |
| 92 | /* the named directory instead of the default configuration directory. |
| 93 | /* Use this to distinguish between multiple Postfix instances on the |
| 94 | /* same host. |
| 95 | /* |
| 96 | /* With Postfix 2.6 and later, this option forces the postfix(1) |
| 97 | /* command to operate on the specified Postfix instance only. |
| 98 | /* This behavior is inherited by postfix(1) commands that run |
| 99 | /* as a descendant of the current process. |
| 100 | /* .IP "\fB-D\fR (with \fBpostfix start\fR only)" |
| 101 | /* Run each Postfix daemon under control of a debugger as specified |
| 102 | /* via the \fBdebugger_command\fR configuration parameter. |
| 103 | /* .IP \fB-v\fR |
| 104 | /* Enable verbose logging for debugging purposes. Multiple \fB-v\fR |
| 105 | /* options make the software increasingly verbose. |
| 106 | /* ENVIRONMENT |
| 107 | /* .ad |
| 108 | /* .fi |
| 109 | /* The \fBpostfix\fR(1) command exports the following environment |
| 110 | /* variables before executing the \fBpostfix-script\fR file: |
| 111 | /* .IP \fBMAIL_CONFIG\fR |
| 112 | /* This is set when the -c command-line option is present. |
| 113 | /* |
| 114 | /* With Postfix 2.6 and later, this environment variable forces |
| 115 | /* the postfix(1) command to operate on the specified Postfix |
| 116 | /* instance only. This behavior is inherited by postfix(1) |
| 117 | /* commands that run as a descendant of the current process. |
| 118 | /* .IP \fBMAIL_VERBOSE\fR |
| 119 | /* This is set when the -v command-line option is present. |
| 120 | /* .IP \fBMAIL_DEBUG\fR |
| 121 | /* This is set when the -D command-line option is present. |
| 122 | /* CONFIGURATION PARAMETERS |
| 123 | /* .ad |
| 124 | /* .fi |
| 125 | /* The following \fBmain.cf\fR configuration parameters are |
| 126 | /* exported as environment variables with the same names: |
| 127 | /* .IP "\fBconfig_directory (see 'postconf -d' output)\fR" |
| 128 | /* The default location of the Postfix main.cf and master.cf |
| 129 | /* configuration files. |
| 130 | /* .IP "\fBcommand_directory (see 'postconf -d' output)\fR" |
| 131 | /* The location of all postfix administrative commands. |
| 132 | /* .IP "\fBdaemon_directory (see 'postconf -d' output)\fR" |
| 133 | /* The directory with Postfix support programs and daemon programs. |
| 134 | /* .IP "\fBhtml_directory (see 'postconf -d' output)\fR" |
| 135 | /* The location of Postfix HTML files that describe how to build, |
| 136 | /* configure or operate a specific Postfix subsystem or feature. |
| 137 | /* .IP "\fBmail_owner (postfix)\fR" |
| 138 | /* The UNIX system account that owns the Postfix queue and most Postfix |
| 139 | /* daemon processes. |
| 140 | /* .IP "\fBmailq_path (see 'postconf -d' output)\fR" |
| 141 | /* Sendmail compatibility feature that specifies where the Postfix |
| 142 | /* \fBmailq\fR(1) command is installed. |
| 143 | /* .IP "\fBmanpage_directory (see 'postconf -d' output)\fR" |
| 144 | /* Where the Postfix manual pages are installed. |
| 145 | /* .IP "\fBnewaliases_path (see 'postconf -d' output)\fR" |
| 146 | /* Sendmail compatibility feature that specifies the location of the |
| 147 | /* \fBnewaliases\fR(1) command. |
| 148 | /* .IP "\fBqueue_directory (see 'postconf -d' output)\fR" |
| 149 | /* The location of the Postfix top-level queue directory. |
| 150 | /* .IP "\fBreadme_directory (see 'postconf -d' output)\fR" |
| 151 | /* The location of Postfix README files that describe how to build, |
| 152 | /* configure or operate a specific Postfix subsystem or feature. |
| 153 | /* .IP "\fBsendmail_path (see 'postconf -d' output)\fR" |
| 154 | /* A Sendmail compatibility feature that specifies the location of |
| 155 | /* the Postfix \fBsendmail\fR(1) command. |
| 156 | /* .IP "\fBsetgid_group (postdrop)\fR" |
| 157 | /* The group ownership of set-gid Postfix commands and of group-writable |
| 158 | /* Postfix directories. |
| 159 | /* .PP |
| 160 | /* Available in Postfix version 2.5 and later: |
| 161 | /* .IP "\fBdata_directory (see 'postconf -d' output)\fR" |
| 162 | /* The directory with Postfix-writable data files (for example: |
| 163 | /* caches, pseudo-random numbers). |
| 164 | /* .PP |
| 165 | /* Available in Postfix version 3.0 and later: |
| 166 | /* .IP "\fBmeta_directory (see 'postconf -d' output)\fR" |
| 167 | /* The location of non-executable files that are shared among |
| 168 | /* multiple Postfix instances, such as postfix-files, dynamicmaps.cf, |
| 169 | /* and the multi-instance template files main.cf.proto and master.cf.proto. |
| 170 | /* .IP "\fBshlib_directory (see 'postconf -d' output)\fR" |
| 171 | /* The location of Postfix dynamically-linked libraries |
| 172 | /* (libpostfix-*.so), and the default location of Postfix database |
| 173 | /* plugins (postfix-*.so) that have a relative pathname in the |
| 174 | /* dynamicmaps.cf file. |
| 175 | /* .PP |
| 176 | /* Available in Postfix version 3.1 and later: |
| 177 | /* .IP "\fBopenssl_path (openssl)\fR" |
| 178 | /* The location of the OpenSSL command line program \fBopenssl\fR(1). |
| 179 | /* .PP |
| 180 | /* Other configuration parameters: |
| 181 | /* .IP "\fBimport_environment (see 'postconf -d' output)\fR" |
| 182 | /* The list of environment parameters that a Postfix process will |
| 183 | /* import from a non-Postfix parent process. |
| 184 | /* .IP "\fBsyslog_facility (mail)\fR" |
| 185 | /* The syslog facility of Postfix logging. |
| 186 | /* .IP "\fBsyslog_name (see 'postconf -d' output)\fR" |
| 187 | /* The mail system name that is prepended to the process name in syslog |
| 188 | /* records, so that "smtpd" becomes, for example, "postfix/smtpd". |
| 189 | /* .PP |
| 190 | /* Available in Postfix version 2.6 and later: |
| 191 | /* .IP "\fBmulti_instance_directories (empty)\fR" |
| 192 | /* An optional list of non-default Postfix configuration directories; |
| 193 | /* these directories belong to additional Postfix instances that share |
| 194 | /* the Postfix executable files and documentation with the default |
| 195 | /* Postfix instance, and that are started, stopped, etc., together |
| 196 | /* with the default Postfix instance. |
| 197 | /* .IP "\fBmulti_instance_wrapper (empty)\fR" |
| 198 | /* The pathname of a multi-instance manager command that the |
| 199 | /* \fBpostfix\fR(1) command invokes when the multi_instance_directories |
| 200 | /* parameter value is non-empty. |
| 201 | /* .IP "\fBmulti_instance_group (empty)\fR" |
| 202 | /* The optional instance group name of this Postfix instance. |
| 203 | /* .IP "\fBmulti_instance_name (empty)\fR" |
| 204 | /* The optional instance name of this Postfix instance. |
| 205 | /* .IP "\fBmulti_instance_enable (no)\fR" |
| 206 | /* Allow this Postfix instance to be started, stopped, etc., by a |
| 207 | /* multi-instance manager. |
| 208 | /* FILES |
| 209 | /* .ad |
| 210 | /* .fi |
| 211 | /* Prior to Postfix version 2.6, all of the following files |
| 212 | /* were in \fB$config_directory\fR. Some files are now in |
| 213 | /* \fB$daemon_directory\fR so that they can be shared among |
| 214 | /* multiple instances that run the same Postfix version. |
| 215 | /* |
| 216 | /* Use the command "\fBpostconf config_directory\fR" or |
| 217 | /* "\fBpostconf daemon_directory\fR" to expand the names |
| 218 | /* into their actual values. |
| 219 | /* .na |
| 220 | /* .nf |
| 221 | /* |
| 222 | /* $config_directory/main.cf, Postfix configuration parameters |
| 223 | /* $config_directory/master.cf, Postfix daemon processes |
| 224 | /* $daemon_directory/postfix-files, file/directory permissions |
| 225 | /* $daemon_directory/postfix-script, administrative commands |
| 226 | /* $daemon_directory/post-install, post-installation configuration |
| 227 | /* $daemon_directory/dynamicmaps.cf, plug-in database clients |
| 228 | /* SEE ALSO |
| 229 | /* Commands: |
| 230 | /* postalias(1), create/update/query alias database |
| 231 | /* postcat(1), examine Postfix queue file |
| 232 | /* postconf(1), Postfix configuration utility |
| 233 | /* postfix(1), Postfix control program |
| 234 | /* postfix-tls(1), Postfix TLS management |
| 235 | /* postkick(1), trigger Postfix daemon |
| 236 | /* postlock(1), Postfix-compatible locking |
| 237 | /* postlog(1), Postfix-compatible logging |
| 238 | /* postmap(1), Postfix lookup table manager |
| 239 | /* postmulti(1), Postfix multi-instance manager |
| 240 | /* postqueue(1), Postfix mail queue control |
| 241 | /* postsuper(1), Postfix housekeeping |
| 242 | /* mailq(1), Sendmail compatibility interface |
| 243 | /* newaliases(1), Sendmail compatibility interface |
| 244 | /* sendmail(1), Sendmail compatibility interface |
| 245 | /* |
| 246 | /* Postfix configuration: |
| 247 | /* bounce(5), Postfix bounce message templates |
| 248 | /* master(5), Postfix master.cf file syntax |
| 249 | /* postconf(5), Postfix main.cf file syntax |
| 250 | /* postfix-wrapper(5), Postfix multi-instance API |
| 251 | /* |
| 252 | /* Table-driven mechanisms: |
| 253 | /* access(5), Postfix SMTP access control table |
| 254 | |
|---|